
//
//  MyViewController.m
//  UI14_HomeWork_豆瓣
//
//  Created by Bodi on 16/6/23.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "MyViewController.h"
#import "MyTableViewCell.h"
#import "MyModel.h"
@interface MyViewController ()<UITableViewDataSource, UITableViewDelegate>
@property (nonatomic, retain)UITableView *tableView;
@property (nonatomic, retain)NSArray *array;

@end

@implementation MyViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self config];
    [self handleData];
    [self createSubView];
    
}



- (void)config{
    self.array = [[NSMutableArray alloc]init];
    self.automaticallyAdjustsScrollViewInsets = NO;
    self.navigationController.navigationBar.barTintColor = [UIColor colorWithRed:0.41f green:0.61f blue:0.68f alpha:1.00f];
    self.navigationItem.title = @"我的";
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"登入" style:UIBarButtonItemStylePlain target:self action:@selector(rightAction:)];
     self.navigationController.navigationBar.tintColor = [UIColor blackColor];
}


- (void)rightAction:(UIBarButtonItem *)item{

}
- (void)handleData{
    
    self.array = @[@"我的活动", @"我的电影", @"清除缓存"];
    
   
    
    
}
- (void)createSubView{
    self.tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 64,CGRectGetWidth(self.view.bounds), CGRectGetHeight(self.view.bounds) - 64) style:UITableViewStylePlain];
    [self.view addSubview:self.tableView];
    [_tableView release];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    self.tableView.rowHeight = 80;
    
//        self.tableView.separatorColor = [UIColor blackColor];
//        _tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
    
    
    [_tableView registerClass:[MyTableViewCell class] forCellReuseIdentifier:@"cell"];
    
    
    
}


//返回每个分区的行数
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    return  10;
    
    
}
//返回每一行上的cell
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    MyTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    

    
       cell.nameLabele.text = @"";
    if (indexPath.row < self.array.count ) {

        cell.nameLabele.text = self.array[indexPath.row];
    }
    
   
    return cell;
    
    
}




//点击uitabView

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
   
    
    
}

















- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
